
	<div class="block">

	<div class="invertedshiftdown">
<ul>
	<?php
	if($organization->type=='s'){
	?>
			<li><a href="?page=organization_inventory&id=<?php echo $organization->id; ?>">查看货存</a></li>
			<li class="current"><a href="?page=organization_sell&id=<?php echo $organization->id; ?>">出售</a></li>
			<li><a href="?page=organization_return&id=<?php echo $organization->id; ?>">退款</a></li>
			<li><a href="?page=organization_distribute&id=<?php echo $organization->id; ?>">分配</a></li>
			<li><a href="?page=organization_distribute_confirm&id=<?php echo $organization->id; ?>">处理待定分配</a></li>
			<li><a href="?page=organization_transaction&id=<?php echo $organization->id; ?>">查看物流记录</a></li>
			<li><a href="?page=organization_sell_record&id=<?php echo $organization->id; ?>">查看销售记录</a></li>
			<li><a href="?page=organization_consume&id=<?php echo $organization->id; ?>">报告损耗/遗失</a></li>
			<li><a href="?page=organization_count&id=<?php echo $organization->id; ?>">货存盘点</a></li>
	<?php
	}elseif($organization->type=='w'){
	?>
	       	<li><a href="?page=organization_inventory&id=<?php echo $organization->id; ?>">查看库存</a></li>
			<li><a href="?page=organization_stack&id=<?php echo $organization->id; ?>">入库</a></li>
			<li><a href="?page=organization_distribute&id=<?php echo $organization->id; ?>">分配</a></li>
			<li><a href="?page=organization_distribute_confirm&id=<?php echo $organization->id; ?>">处理待定分配</a></li>
			<li><a href="?page=organization_transaction&id=<?php echo $organization->id; ?>">查看物流记录</a></li>
			<li><a href="?page=organization_consume&id=<?php echo $organization->id; ?>">报告损耗/遗失</a></li>
			<li><a href="?page=organization_count&id=<?php echo $organization->id; ?>">货存盘点</a></li>
    <?php
	}
	?>
</ul>




<form id="myform">
<input type="text" class="textinput" /> <input class="submit" type="submit" value="搜索" />
</form>
</div>

<br style="clear: both;" />
<div id= 'content'>

	<h2><?php echo $organization->name ?> 》销售界面</h2>
		<?php
	//print_r($_GET);
	if(isset($_GET['stat'])){
		if($_GET['stat']=='sold'){
	?>
	<div class='isa_success'>
		<h4>操作成功：</h4>出售
	</div>
	
	<?php
		}elseif($_GET['stat']=='error'&&$_GET['error']=='limit'){
	?>
	<div class="isa_warning">
		<h4>操作失败：</h4>无法出售（货存数量有限）
	</div>
    <?php
		}elseif($_GET['stat']=='error'&&$_GET['error']=='missing'){
	?>
	<div class="isa_warning">
		<h4>操作失败：</h4>无法出售（缺省必要参数）
	</div>
	
		<?php
		}elseif($_GET['stat']=='error'&&$_GET['error']=='badData'){
	?>
	<div class="isa_warning">
		<h4>操作失败：</h4>无法出售（提交了无效数据）
	</div>
<?php

		}
}
?>
	<br>
<form action="api/" method="post">
        	<input type="hidden" id='action' name="action" value="organization_sell" />
        	<input type="hidden" id='user1' name="user1" value="<?php echo $currentUser->id ?>" />
        	<input type="hidden" id='source' name="source" value="<?php echo  $organization->id ?>" />        	
	<?php
	echo $table;
	?>
		<br>
<br>

   
    	<h4>方法一，选择以上的其中一种产品,然后再填写数量和金额</h4>
    	<div class="important">若所出售产品的条形码若没能在上面列表找到请联络管理员</div>
    	<br>
              <div class="element" style="clear:both;">
              	<input type="radio" name="val" value="unit" checked>单价</input>
              	<input type="radio" name="val" value="total">总价</input>
               <label class="form">金额</label>
             <input type="text" name="amount" value="" ><div class="important">若为空，则按官方定价算</div>
             </div>
              <div class="element" style="clear:both;">
               <label class="form">数目</label>
             <input type="text" name="number" value="1" >
             </div>
             <div class="element" style="clear:both;">
               <label class="form">发票单（可不填）</label>
             <input type="text" name="code" >
             </div>
             <?php
if(count($organization->getInventory())){
             ?>
             <div class="element" style="clear:both;">
             <input type="submit" value="出售" />
             </div>
             <?php
}else{
             ?>
             <div class="element" style="clear:both;">
             <input type="submit" value="出售" disabled />
             </div>
             <?php
}
             ?>
		    </form>


		    <hr>

<form action="api/" method="post">
        	<input type="hidden" id='action' name="action" value="organization_sell" />
        	<input type="hidden" id='user1' name="user1" value="<?php echo $currentUser->id ?>" />
        	<input type="hidden" id='source' name="source" value="<?php echo  $organization->id ?>" />        	

   
    	<h4>方法二，直接输入要出售的扫描条形码（无需选择表中任何库存）</h4>
    	<div class="important">若输入的扫描条形码不在库存中，此出售会失败</div>
    	<br>
    	     <div class="element" style="clear:both;">
               <label class="form">扫描条形码</label>
             <input type="text" name="scan_code" maxlength="14" size="14" >
             </div>
              <div class="element" style="clear:both;">
              	<input type="radio" name="val" value="unit" checked>单价</input>
              	<input type="radio" name="val" value="total">总价</input>
               <label class="form">金额</label>
             <input type="text" name="amount" value="" ><div class="important">若为空，则按官方定价算</div>
             </div>
              <div class="element" style="clear:both;">
               <label class="form">数目</label>
             <input type="text" name="number" value="1" >
             </div>
                          <div class="element" style="clear:both;">
               <label class="form">发票单（可不填）</label>
             <input type="text" name="code" >
             </div>
             <?php
if(count($organization->getInventory())){
             ?>
             <div class="element" style="clear:both;">
             <input type="submit" value="出售" />
             </div>
             <?php
}else{
             ?>
             <div class="element" style="clear:both;">
             <input type="submit" value="出售" disabled />
             </div>
             <?php
}
             ?>
		    </form>

<br>
<br>
<br>
   
<div class="clear"></div>
	</div>